package com.game.majiang.vo;

import java.sql.Types;

import com.game.server.db.Parameter;
import com.game.server.db.ParameterType;
import com.game.server.db.SqlHelper;
import com.game.server.db.SqlHelperwrite;

import lombok.Data;

@Data
public class RechargeVo {

	public static boolean insertRechargeVo(int id,int money,int status,String order,int gold)
	{
		String cmdText = "insert into recharge(userId,money,createtime,`status`,`order`,gold)values(?,?,now(),?,?,?)";
		Parameter p1 = new Parameter(Types.INTEGER, id, ParameterType.Input);
		Parameter p2 = new Parameter(Types.INTEGER, money, ParameterType.Input);
		Parameter p3 = new Parameter(Types.INTEGER, status, ParameterType.Input);
		Parameter p4 = new Parameter(Types.VARCHAR, order, ParameterType.Input);
		Parameter p5 = new Parameter(Types.INTEGER, gold, ParameterType.Input);
	   int i= SqlHelperwrite.execute(cmdText,p1,p2,p3,p4,p5);
	   if(i>0){
		   return true;
	   }else{
		   return false;
	   }
	}

	/**
	 * 	
	 * @param id
	 */
	public static void updateRecharge(int id,String order,int zuangshi) {
		String cmdText = "update recharge set `status` = 1,dangqianzuanshi = ? where userId=? and `status` = 0 and `order`=?";
		Parameter p1 = new Parameter(Types.INTEGER, zuangshi, ParameterType.Input);
		Parameter p2 = new Parameter(Types.INTEGER, id, ParameterType.Input);
		Parameter p3 = new Parameter(Types.VARCHAR, order, ParameterType.Input);
		SqlHelperwrite.execute(cmdText,p1,p2,p3);
	}

}
